<?php
$query = $db->query("SELECT SUM(`price`) AS sum from uses");
$res = $db->fetch_assoc($query);

$total_costs = split_price($res['sum']);


//$start = new DateTime($date->start_date);
//$end = new DateTime($date->last_date);
//$diff = $end->diff($start);
//$diff = $diff->format("%a");

//$avr_day_costs = split_price($total_costs/$diff);

$msg->info("Добре дошли в системата");
if($date->last_unix_time < $date->today_unix_time){
	$msg->info("Има незавършени разходи за <a href=\"index.php?p=addcosts&amp;date={$date->last_date}\">{$date->last_day} {$date->last_month_title} {$date->last_year}</a>");
}
$msg->write("<div id=\"list\"><span>Статистика</span><ul>");
	$msg->write("<li>Начало на отчитането: {$date->start_day} {$date->start_month_title} {$date->start_year}</li>");
	$msg->write("<li>Общо разходи: $total_costs лв.</li>");
//	$msg->write("<li>Средно разходи за ден: $avr_day_costs лв.</li>");
$msg->write("</ul></div>");
?>